]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Don't always extend struts to the screen edge
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 15 Apr 2014 15:24:07 +0000 (17:24 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 15 Apr 2014 21:35:06 +0000 (23:35 +0200)
NetWM struts are defined in terms of screen edges (rather than monitor
edges), which works poorly with vertical monitor layouts (as it renders
entire monitors unusable). Don't extend struts in those cases.

https://bugzilla.gnome.org/show_bug.cgi?id=663690

js/ui/layout.js

index 80428a586f48c46f7231461e66de8970847a5efd..c1fdc7446ff203a90bca7c03f1a7e38329e33e55 100644 (file)
@@ -1018,19 +1018,39 @@ const LayoutManager = new Lang.Class({
                     continue;
 
                 // Ensure that the strut rects goes all the way to the screen edge,
-                // as this really what mutter expects.
+                // as this really what mutter expects. However skip this step
+                // in cases where this would render an entire monitor unusable.
                 switch (side) {
                 case Meta.Side.TOP:
-                    y1 = 0;
+                    let hasMonitorsAbove = this.monitors.some(Lang.bind(this,
+                        function(mon) {
+                            return this._isAboveOrBelowPrimary(mon) &&
+                                   mon.y < primary.y;
+                        }));
+                    if (!hasMonitorsAbove)
+                        y1 = 0;
                     break;
                 case Meta.Side.BOTTOM:
-                    y2 = global.screen_height;
+                    if (this.primaryIndex == this.bottomIndex)
+                        y2 = global.screen_height;
                     break;
                 case Meta.Side.LEFT:
-                    x1 = 0;
+                    let hasMonitorsLeft = this.monitors.some(Lang.bind(this,
+                        function(mon) {
+                            return !this._isAboveOrBelowPrimary(mon) &&
+                                   mon.x < primary.x;
+                        }));
+                    if (!hasMonitorsLeft)
+                        x1 = 0;
                     break;
                 case Meta.Side.RIGHT:
-                    x2 = global.screen_width;
+                    let hasMonitorsRight = this.monitors.some(Lang.bind(this,
+                        function(mon) {
+                            return !this._isAboveOrBelowPrimary(mon) &&
+                                   mon.x > primary.x;
+                        }));
+                    if (!hasMonitorsRight)
+                        x2 = global.screen_width;
                     break;
                 }